import type { User01Response } from '@/request'
import { defineStore } from 'pinia'

interface USERINFOSTORE {
  userInfo: Partial<User01Response> & {
    expired?: boolean
  }
  userAddress: User01Response['address'] | null
}

export const useUserStore = defineStore('userInfo', {
  state(): USERINFOSTORE {
    return {
      userInfo: {},
      userAddress: null,
    }
  },
  actions: {
    change(value: any) {
      this.userInfo = Object.assign({}, this.userInfo, value)
    },
    changeAddress(value: User01Response['address']) {
      this.userAddress = value
    },
  },
})
